package com.its.us.web.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @className ResponseUtil
 * @author huguangjun
 * @date 2020/12/3
 * @desc 9:09
 */
public class ResponseUtil {


    /**
     * 响应
     * @param response
     * @param status
     * @param result
     * @throws IOException
     */
    public static void out( int status,HttpServletResponse response,String result) throws IOException {
        // 响应状态
        response.setStatus(status);
        // 返回json格式
        response.setHeader("Content-Type", "application/json;charset=UTF-8");
        PrintWriter pw = response.getWriter();
        pw.write(result);
        pw.flush();
        pw.close();
    }
}
